package com.dongdongshop.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.data.Result;
import com.dongdongshop.pojo.type_template.TbTypeTemplate;
import com.dongdongshop.service.type_template.TypeTemPlateService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("typeTemplate")
public class TypeTemPlateController {
    @Reference
    private TypeTemPlateService typeTemPlateService;
    private final Logger logger = LoggerFactory.getLogger(TypeTemPlateController.class);
    @RequestMapping("getTypeTemplate")
    @ResponseBody
    public Result getTypeTemplate(Long id){
        try {
            TbTypeTemplate typeTemplate = typeTemPlateService.getTypeTemplate(id);
            return Result.ok().setInfo(typeTemplate);
        }catch (Exception e){
            logger.error("回显品牌失败",e);
            return Result.fail();
        }
    }
}
